import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import AutoImport from 'unplugin-auto-import/vite'
import { resolve } from 'path'  // 这个 下载了 @types/node 不然爆红

// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    alias: {
      '@': resolve(__dirname, "src"),
    },
  },
  plugins: [uni(),
  AutoImport({
    include: [
      /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
      /\.vue$/,
      /\.vue\?vue/, // .vue
    ],
    // 自动导入vue相关的Api
    imports: [
      'vue',
      'uni-app',
      'pinia',
     
    ],
    // 生成auto-import.d.ts声明文件
    dts: 'typings/.auto-import.d.ts',
    eslintrc: {
      enabled: true, // Default `false` 如果有改文件 可以设置成false
      filepath: 'typings/.eslintrc-auto-import.json', // Default `./.eslintrc-auto-import.json`
      globalsPropValue: true, // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
    },
  })
  ],
});
